home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / wgdb-42.lha / wgdb-4.2 / gdb / xm-sun2.h < prev    next >
Text File  |  1992-09-11  |  3KB  |  97 lines

  1. /* Parameters for execution on a Sun, for GDB, the GNU debugger.
  2.    Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
  3.  
  4. This file is part of GDB.
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #define HOST_BYTE_ORDER BIG_ENDIAN
  21.  
  22. /* This is the amount to subtract from u.u_ar0
  23.    to get the offset in the core file of the register values.  */
  24.  
  25. #define KERNEL_U_ADDR 0x2800
  26.  
  27. /* Enable use of alternate code for Sun's format of core dump file.  */
  28.  
  29. #define NEW_SUN_CORE
  30.  
  31. /* Do implement the attach and detach commands.  */
  32.  
  33. #define ATTACH_DETACH
  34.  
  35. /* Override copies of {fetch,store}_inferior_registers in infptrace.c.  */
  36. #define FETCH_INFERIOR_REGISTERS
  37.  
  38. /* This is a piece of magic that is given a register number REGNO
  39.    and as BLOCKEND the address in the system of the end of the user structure
  40.    and stores in ADDR the address in the kernel or core dump
  41.    of that register.  */
  42.  
  43. #define REGISTER_U_ADDR(addr, blockend, regno)        \
  44. { addr = blockend + regno * 4; }
  45.  
  46. /* Interface definitions for kernel debugger KDB.  */
  47.  
  48. /* Map machine fault codes into signal numbers.
  49.    First subtract 0, divide by 4, then index in a table.
  50.    Faults for which the entry in this table is 0
  51.    are not handled by KDB; the program's own trap handler
  52.    gets to handle then.  */
  53.  
  54. #define FAULT_CODE_ORIGIN 0
  55. #define FAULT_CODE_UNITS 4
  56. #define FAULT_TABLE    \
  57. { 0, 0, 0, 0, SIGTRAP, 0, 0, 0, \
  58.   0, SIGTRAP, 0, 0, 0, 0, 0, SIGKILL, \
  59.   0, 0, 0, 0, 0, 0, 0, 0, \
  60.   SIGILL }
  61.  
  62. /* Start running with a stack stretching from BEG to END.
  63.    BEG and END should be symbols meaningful to the assembler.
  64.    This is used only for kdb.  */
  65.  
  66. #define INIT_STACK(beg, end)  \
  67. { asm (".globl end");         \
  68.   asm ("movel $ end, sp");      \
  69.   asm ("clrl fp"); }
  70.  
  71. /* Push the frame pointer register on the stack.  */
  72. #define PUSH_FRAME_PTR        \
  73.   asm ("movel fp, -(sp)");
  74.  
  75. /* Copy the top-of-stack to the frame pointer register.  */
  76. #define POP_FRAME_PTR  \
  77.   asm ("movl (sp), fp");
  78.  
  79. /* After KDB is entered by a fault, push all registers
  80.    that GDB thinks about (all NUM_REGS of them),
  81.    so that they appear in order of ascending GDB register number.
  82.    The fault code will be on the stack beyond the last register.  */
  83.  
  84. #define PUSH_REGISTERS        \
  85. { asm ("clrw -(sp)");          \
  86.   asm ("pea 10(sp)");          \
  87.   asm ("movem $ 0xfffe,-(sp)"); }
  88.  
  89. /* Assuming the registers (including processor status) have been
  90.    pushed on the stack in order of ascending GDB register number,
  91.    restore them and return to the address in the saved PC register.  */
  92.  
  93. #define POP_REGISTERS          \
  94. { asm ("subil $8,28(sp)");     \
  95.   asm ("movem (sp),$ 0xffff"); \
  96.   asm ("rte"); }
  97.